/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.util;

import br.com.deployment.entidade.tramite.Tramite;
import java.util.List;
import javax.faces.model.ListDataModel;
import org.primefaces.model.SelectableDataModel;

/**
 *
 * @author roniere
 */
public class TramiteModel extends ListDataModel<Tramite> implements SelectableDataModel<Tramite> {

    public TramiteModel(List<Tramite> list) {
        super(list);
    }

    public TramiteModel() {
    }

    
    @Override
    public Object getRowKey(Tramite t) {
        return t.getId();
    }

    @Override
    public Tramite getRowData(String string) {
        List<Tramite> tr = (List<Tramite>) getWrappedData();
        for(Tramite sp : tr) {  
            if(sp.getId() == Integer.parseInt(string))  
                return sp;  
        } 
        return null; 
    }
    
}
